home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / rjs.lha / RJS / Transport / tests / ds.C < prev    next >
C/C++ Source or Header  |  1991-06-14  |  710b  |  40 lines

  1. #include <iostream.h>
  2. #include <fstream.h>
  3. #include <stdio.h>
  4. #include <osfcn.h>
  5. #include <libc.h>
  6.  
  7. #include "RJS/Transport.h"
  8.  
  9. static char buffer [512000];
  10.  
  11. void test(char *the_file)
  12. {
  13.  
  14.  RJS_DECnetSeqPacket server,client;        // create server
  15.  RJS_DECnetAddress object(140);
  16.  
  17. // object.dump();
  18. // cout << object.ss_message() << endl;
  19.  
  20.  fstream bin_file(the_file,ios::in);
  21.  bin_file.read(buffer,512000);
  22.  int size=bin_file.gcount();
  23. cout << "server writing ==> " << size << endl;
  24.  server.passive(object);
  25.  server.linger();
  26.  server.accept(client);        // accept a client
  27.  
  28.  client.linger();
  29.  client.write(buffer,size);    // write to client
  30.  sleep(5);
  31.  
  32. }
  33.  
  34.  
  35. int main(int argc, char *argv[]) 
  36. {
  37.  test(argv[1]);
  38.  exit(0);
  39. }
  40.